package com.demo;

import java.util.concurrent.ConcurrentLinkedDeque;

public class TaskMain 
{
	public static void main(String[] args) 
	{
		ConcurrentLinkedDeque<String> list = new ConcurrentLinkedDeque<String>();
		
		Thread threads[] = new Thread[100];
		
		for (int i = 0; i < 100; i++) 
		{
			AddTask task = new AddTask(list);
			threads[i] = new Thread(task);
			threads[i].start();
		}
		
		System.out.printf("Main: %d AddTask threads have been launched\n", threads.length);
		
		for (int i = 0; i < threads.length; i++)
		{
			try
			{
				threads[i].join();
			}
			catch(Exception e)
			{
				e.printStackTrace();
			}
		}
		
		System.out.printf("Main: Size of the List: %d\n", list.size());
	}
}
